from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from . import views

urlpatterns = [
    url(r'^categories/(?P<pk>\d+)/$', views.GoodCategorieView.as_view()),
    url(r'^categories/(?P<pk>\d+)/skus/$', views.SKUListView.as_view()),
    url(r'^goods/brands/simple/$', views.GoodsBrands.as_view({
        'get': 'simple',
    })),
    url(r'^goods/channel/categories/(?P<pk>\d+)/$', views.SPUCategoriesViewSet.as_view({
        'get': 'categories_detail',
    })),
    url(r'^goods/specs/simple/$', views.GoodsSpecificationViewSet.as_view({
        'get': 'simple',
    })),
    url(r'^skus/simple/$', views.GoodsViewSet.as_view({
        'get': 'simple',
    })),
url(r'^goods/simple/$', views.GoodsViewSet.as_view({
        'get': 'simple',
    })),

]

router = DefaultRouter()
router.register('skus/search', views.SKUSearchViewSet, base_name='skus_search')
urlpatterns += router.urls

brands_router = DefaultRouter()
brands_router.register('^goods/brands', views.GoodsBrands, base_name='goods_brands')
urlpatterns += brands_router.urls

channel_router = DefaultRouter()
channel_router.register('^goods/channels', views.GoodsChannelViewSet, base_name='channel')
urlpatterns += channel_router.urls

category_router = DefaultRouter()
category_router.register('^goods/channel/categories', views.SPUCategoriesViewSet, base_name='category')
urlpatterns += category_router.urls

skus_categories = DefaultRouter()
skus_categories.register('^skus/categories', views.SPUCategoriesViewSet, base_name='skus_categories')
urlpatterns += skus_categories.urls

option_router = DefaultRouter()
option_router.register('^specs/options', views.SpecificationOptionViewSet, base_name='option')
urlpatterns += option_router.urls

goods_sepc_router = DefaultRouter()
goods_sepc_router.register('^goods/specs', views.GoodsSpecificationViewSet, base_name='specs')
urlpatterns += goods_sepc_router.urls

img_router = DefaultRouter()
img_router.register('^skus/images', views.GoodsImageViewSet, base_name='img')
urlpatterns += img_router.urls

sku_router = DefaultRouter()
sku_router.register('^skus', views.SkuViewSet, base_name='skus')
urlpatterns += sku_router.urls

goods_router = DefaultRouter()
goods_router.register('^goods', views.GoodsViewSet, base_name='goods')
urlpatterns += goods_router.urls
